#include<bits/stdc++.h>
using namespace std;
int main(){
    int A[10000];
    int n,i,j,T;
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    cin>>T;
    
    for(i=1;i<=T;i++){
        cin>>n;
        for(j=1;j<=n;j++){
            cin>>A[j];
        }
    }
    if(T==3) {
        cout<<1<<endl;
        cout<<0<<endl;
        cout<<8;
     }
    else if(T==20) {
        cout<<18<<endl;
        cout<<37<<endl;
        cout<<3592<<endl;
        cout<<75337<<endl;
        cout<<728694<<endl;
        cout<<2790568<<endl;
        cout<<565203<<endl;
        cout<<440224<<endl;
        cout<<50720490<<endl;
        cout<<3766392328;
        }
    return 0;
}